//
//  InviteListHeaderView.m
//  CBT
//
//  Created by Mr.Zhang on 2019/3/2.
//  Copyright © 2019 Mr.Zhang. All rights reserved.
//

#import "InviteListHeaderView.h"

@interface InviteListHeaderView()

/** 总邀请人数 */
@property (weak, nonatomic) IBOutlet UILabel *inviTotalLabel;

/** 总实名人数 */
@property (weak, nonatomic) IBOutlet UILabel *realTotalLabel;

/** 有效邀请人数 */
@property (weak, nonatomic) IBOutlet UILabel *investTotalLabel;

/** 总邀请收益 */
@property (weak, nonatomic) IBOutlet UILabel *intitedTotalIncomeLabel;

/** 有效邀请人数数量 */
@property (weak, nonatomic) IBOutlet UILabel *investTotalCountLabel;

/** 总邀请收益数量 */
@property (weak, nonatomic) IBOutlet UILabel *intitedTotalCountLabel;

/*总业绩 */
@property (weak, nonatomic) IBOutlet UILabel *totalArchivement;
/*直推业绩*/
@property (weak, nonatomic) IBOutlet UILabel *directArchivement;

@end

@implementation InviteListHeaderView

-(void)setModel:(RewardRecordModel *)model {
    self.inviTotalLabel.text = [NSString stringWithFormat:@"%@（PC） ",kLocalizedString(@"总业绩",nil)];
    self.totalArchivement.text = [NSString stringWithFormat:@"%@",model.allAchievement];
    
    self.realTotalLabel.text = [NSString stringWithFormat:@"%@（PC）",kLocalizedString(@"直推业绩",nil)];
    self.directArchivement.text = [NSString stringWithFormat:@"%@",model.directAchievement];
    
    self.investTotalLabel.text = [NSString stringWithFormat:@"%@（PC）",kLocalizedString(@"总收益",nil)];
    self.intitedTotalIncomeLabel.text = [NSString stringWithFormat:@"%@（PC）",kLocalizedString(@"直推收益",nil)];
    self.investTotalCountLabel.text = [NSString numberExcludeNullString:model.allProfit];
    self.intitedTotalCountLabel.text = [NSString numberExcludeNullString:model.directProfit];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    __weak typeof(self)weakself = self;
    [self.totalArchivement mas_updateConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(weakself.inviTotalLabel);
        make.width.mas_equalTo(weakself.inviTotalLabel);
        make.top.mas_equalTo(weakself.inviTotalLabel.mas_bottom).offset(10);
    }];
    
    [self.directArchivement mas_updateConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(weakself.realTotalLabel);
        make.width.mas_equalTo(weakself.realTotalLabel);
        make.top.mas_equalTo(weakself.realTotalLabel.mas_bottom);
    }];
    
}

@end
